<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var car = (function(){
            var start = 13;
            var totle = 0;
            return{
                price : function(n){
                totle = n <= 3 ? start : start + (n - 3)*5;
                return totle;
                },
                yd: function(flag){
                    return flag ? totle + 10 : totle;
                }
            }
        })();
        console.log(car.price(5));//23
        console.log(car.yd(true));//33

        console.log(car.price(3));//13
        console.log(car.yd(false));//13
    </script>
</body>
</html>